package com.timous.链表;

/**
 * https://leetcode-cn.com/problems/fan-zhuan-lian-biao-lcof/
 * @author Timous
 * @create 2020-12-21 15:49
 **/
public class _剑指Offer24_反转链表 {


    public ListNode reverseList(ListNode head) {
        if (head == null){
            return null;
        }
        if (head.next == null){
            return head;
        }

        ListNode newHead = reverseList(head.next);
        head.next.next = head.next;
        head.next = null;
        return newHead;
    }

}
